#include <stdio.h>  
#include <time.h>  
#include <stdlib.h>  
void menu()  
{  
    printf("**********************\n");  
    printf("****1.play  0.exit****\n");  
    printf("**********************\n");  
}  
void play_game()  
{  
    int tmp = 0;  
    int rand_n = rand() % 100;          //使随机数的大小在0-100之间  
    while (1)  
    {  
        printf("please input num>>:");  
        scanf("%d", &tmp);  
        if (tmp == rand_n)  
        {  
            printf("right, you are smart\n");  
            break;  
        }  
        else if (tmp > rand_n)  
        {  
            printf("on,on,on it is too big\n");  
        }  
        else  
        {  
            printf("on,on,on it is too samll\n");  
        }  
    }  
}  
  
int main()  
{  
    int input;  
    srand((unsigned int)time(NULL));        //产生一个随机数  
    do  
    {  
        menu();  
        printf("select menu>>:");  
        scanf("%d", &input);  
        switch (input)  
        {  
        case 1:  
        {  
                  play_game();  
                  break;  
        }  
        case 0:  
        {  
                  exit(EXIT_SUCCESS);  
                  break;  
        }  
        default:  
        {  
                printf("error\n");  
                  continue;  
        }  
        }  
    } while (input);  
    return 0;  
}  
